<template>
  <div class="page has-navbar has-tabbar" v-nav="{title: '启辕合作', showBackButton: true}">
		<div class="page-content padding-top reserve-margin">
      <form action="" @submit.prevent="submit">
        <list>
          <p class="cooperation">如果您不是启辕的合作商户，请填写合作信息，留下您的联系方式，我们会尽快与您联系，或者拨打客服电话400-150-1999</p>
          <item style="padding:0 15px;">
            <div class="car-enitor-tr">
              <div class="car-editor-name">联系方式</div>
              <div class="car-editor-input"><input type="tell" name="cooperationMobile" placeholder="请输入您的手机号" v-model="phone" required onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" autocomplete="off" maxlength=11 /></div>
              <div class="car-editor-right"></div>
            </div>
          </item>
        </list>
        <button type="submit" class="md-button button button-assertive button-block" style="margin:0 15px; width: calc(100% - 30px); background:#FF6816;">保存</button>
      </form>
		</div>
	</div>
</template>
<script>
export default {
  data () {
    return {
      getCodeShow: 0,
      phone: '',
      code: '',
      password: '',
      newpassword: ''
    }
  },
  methods: {
    submit (event) {
      if (!(/^[0-9]{11}$/gi.test(this.phone))) {
        window.$toast.show('请输入正确手机号')
        return false
      }
      
      let fd = new FormData(event.target)
      window.axios.post(baseUrl + '/controller/cooperation/insertCooperation', fd).then(res => {
        if (res) {
          setTimeout(() => {
            window.$toast.show('提交成功')
            setTimeout(() => {
              this.$router.back('/login')
            }, 1000)
          }, 400)
        }
      })
    }
  }
}
</script>
<style scoped>
  .cooperation{ padding: 18px; color: #323232; font-size: 14px;}
  .car-editor-right{ padding: 0;}
  .car-password-code{background: #FF6816; color:  #fff; height: 40px; margin: 5px 0; padding: 0 10px; line-height: 40px; border-radius: 2px;}
  .car-password-codeoff{height: 40px; margin: 5px 0; padding: 0 10px; line-height: 40px; border-radius: 2px;border: 1px solid #aaa; box-sizing: border-box; width: 85px; text-align: center; font-size: 16px;}
</style>

